package ocean.chinacraft.common.world.gen;

import net.minecraft.util.ResourceLocation;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.GenerationStage;
import net.minecraftforge.event.world.BiomeLoadingEvent;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.IForgeRegistry;
import ocean.chinacraft.common.world.gen.features.ModConfiguredFeatures;

/**
 * 植物生成
 *
 * @author zhang
 * @since 2022/1/6
 */
public class ModPlantsGeneration {

    public static void generatePlant(final BiomeLoadingEvent event) {
        if (event.getName() != null) {
            IForgeRegistry<Biome> biomes = ForgeRegistries.BIOMES;
            for (Biome biome : biomes) {
                if (biome == biomes.getValue(new ResourceLocation("bamboo_jungle")) ||
                        biome == biomes.getValue(new ResourceLocation("bamboo_jungle_hills"))) {
                    event.getGeneration().addFeature(GenerationStage.Decoration.VEGETAL_DECORATION,
                            ModConfiguredFeatures.LIGHTNING_BAMBOO_SAPLING);
                }
            }
        }
    }
}